﻿@using System.Data
@using ZoomLa.Model
@using ZoomLa.BLL
@using ZoomLa.BLL.Helper
@using ZoomLa.Common
@model ZoomLaCMS.Models.Cloud.VM_Cloud
@{
    
}
@section head{
<style>
.cloud_dirdiag { width: 450px; }
.cloudmanage .hoverDiv a { display: inline-block; margin-left: 10px; }
</style>
<link href="/Plugins/Uploadify/style.css" rel="stylesheet" type="text/css" />
<title>网络云盘</title>
}
@section content{
    <div id="pageflag" data-nav="cloud" data-ban="cloud"></div>
    <div class="container u_cnt">
        @if (Model.mu.IsCloud != 1)
        {
            <div id="OpenCloud" style="padding:15px;">
               <a href="Cloud_Open" class="btn btn-primary"><i class="fa fa-cloud"></i> 您还没有云盘,点击开通云盘</a>
            </div>
        }
        else
        {
            <div class="cloudmanage margin_t10">
            <div id="Cloud">
                @Html.Partial("Cloud_List")
            </div>
            <div class="us_seta btn_green text-left margin_t10" id="us_seta">
                <input type="button" class="btn btn-primary" name="demoCode04-3" value="上传文件" onclick="ShowFileDiag()" />
                <input type="button" class="btn btn-primary" id="newFile" value="新建文件夹" onclick="ShowDirDiag()" />
            </div>
        </div>

        <div class="modal fade" id="dir_modal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="modal-title">目录管理</h4>
                    </div>
                    <div class="wrap">
                        <input type="text" id="DirName_T" name="DirName_T" class="form-control text_300" />
                        <input type="button" value="创建目录" class="btn btn-primary" onclick="newDir();" />
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade" id="file_modal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="modal-title">文件上传</h4>
                        <div class="wrap"><input type="file" id="files" /></div>
                    </div>
                </div>
            </div>
        </div>
        }
    </div>
}
@section script{
<style type="text/css">
.wrap {padding:10px;}
</style>
<script src="/Plugins/Uploadify/jquery.uploadify.js"></script>
<script src="/JS/Controls/ZL_Dialog.js"></script>
<script src="/JS/ZL_Regex.js"></script>
<script>
    function ShowDirDiag() {
        $("#DirName_T").val("");
        $("#dir_modal").modal({});
    }
    var FileDiag = new ZL_Dialog();
    function ShowFileDiag() {
        $("#file_modal").modal({});
    }
    var prediag = new ZL_Dialog();
    function prefile(guid) {
        prediag.title = "预览文件";
        prediag.url = "/BU/Front/PreView.aspx?CloudFile=" + guid;
        prediag.maxbtn = false;
        prediag.ShowModal();
        $('.modal').css('top', '100px');
        $('.modal-body').css('height', '600px');
    }
    function newDir() {
        var dir = $("#DirName_T").val();
        if (ZL_Regex.isEmpty(dir)) { alert("目标名不能为空"); return; }
        $.post("cloud_newdir?type=@Model.FType&dir=@Model.VDir", { "DirName_T": dir }, function (data) {
            location = location;
        });
    }
    $(function () {
        $("#files").uploadify({
            //按钮宽高
            width: 120,
            height: 35,
            auto: true,
            swf: '/Plugins/Uploadify/uploadify.swf',
            uploader: '/Plugins/Uploadify/UploadFileHandler.ashx',
            buttonText: "上传附件",
            buttonCursor: 'hand',
            fileTypeExts: "*.*",
            fileTypeDesc: "请选择文件",
            fileSizeLimit: "50000KB",
            formData: { "action": "Cloud_Doc", "value": "@Model.VDir", "Type": "@Model.FType" },
            queueSizeLimit: 3,
            removeTimeout: 2,
            multi: true,
            onUploadStart: function (file) { },
            onUploadSuccess: function (file, data, response) {//json,result,tru||false
            },
            onQueueComplete: function (queueData) { location = location; },
            onUploadError: function (file) { }
        });
    })
</script>
}
